<script>


    function isMobile(){
    if(window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
     return '移动端'; // 移动端
    }else if(window.navigator.userAgent.match(/(MicroMessenger)/i)){
        return '微信';
    }
    else{
     return 'pc端'; // PC端
    }
   }
   isMobile()
  var isMobile = isMobile()
console.log(isMobile)
alert(isMobile)
</script>